cmake_minimum_required(VERSION 2.8)

project(libtpool)

#set(SOURCES tpool.cpp file.cpp)
aux_source_directory(. SOURCES)

set(HEADERS threadpool.h tpthread.h)

if(MSVC)
    add_definitions(-DTPOOL_EXPORTS)
endif()

if(BUILD_SHARED_LIBS)
    add_library(tpool SHARED ${SOURCES} ${HEADERS})
    install(TARGETS tpool DESTINATION lib)
endif()

if(BUILD_STATIC_LIBS)
    add_library(tpool_static STATIC ${SOURCES} ${HEADERS})
    set_target_properties(tpool_static PROPERTIES OUTPUT_NAME "tpool")
    install(TARGETS tpool_static DESTINATION lib)
endif()

install(FILES ${HEADERS} DESTINATION include)
